window_backed_app_get_window (ShellApp *app)
{
g_assert (app->info == NULL);
- g_assert (app->running_state);
- g_assert (app->running_state->windows);
- return app->running_state->windows->data;
+ if (app->running_state)
+ {
+ g_assert (app->running_state->windows);
+ return app->running_state->windows->data;
+ }
+ else
+ return NULL;
}
static ClutterActor *
window_backed_app_get_icon (ShellApp *app,
int size)
{
- MetaWindow *window;
+ MetaWindow *window = NULL;
ClutterActor *actor;
gint scale;
ShellGlobal *global;
* window-backend apps, it's possible we get a request for the icon.
* Avoid asserting here and just return an empty image.
*/
- if (app->running_state == NULL)
+ if (app->running_state != NULL)
+ window = window_backed_app_get_window (app);
+
+ if (window == NULL)
{
actor = clutter_texture_new ();
g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
return actor;
}
- window = window_backed_app_get_window (app);
actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
G_OBJECT (window),
"icon");
else
{
MetaWindow *window = window_backed_app_get_window (app);
- const char *name;
+ const char *name = NULL;
- name = meta_window_get_wm_class (window);
+ if (window)
+ name = meta_window_get_wm_class (window);
if (!name)
name = C_("program", "Unknown");
return name;
if (app->info == NULL)
{
MetaWindow *window = window_backed_app_get_window (app);
- meta_window_activate (window, timestamp);
+ /* We don't use an error return if there no longer any windows, because the
+ * user attempting to activate a stale window backed app isn't something
+ * we would expect the caller to meaningfully handle or display an error
+ * message to the user.
+ */
+ if (window)
+ meta_window_activate (window, timestamp);
return TRUE;
}